package com.hdax.dm.config;

import com.hdax.dm.common.utils.CommonResponse;
import com.hdax.dm.common.utils.ResponseUtil;
import com.hdax.dm.exceptions.DmException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler(value = {DmException.class})
    public CommonResponse exceptionHandler(DmException e){
        log.error("程序异常：{}",e.getMessage());
        return ResponseUtil.returnFail(e);
    }
}
